/*** 
 * @Date: 2020-07-09 18:10:59
 * @LastEditors: leehave
 * @LastEditTime: 2020-09-05 15:47:08
 */
/*** 
 * @Date: 2020-07-09 18:10:59
 * @LastEditors: leehave
 * @LastEditTime: 2020-08-13 10:05:58
 */
 import qs from 'qs'
 import request from '@/utils/request'
 import store from '@/store'
 import { PORT } from './api'
 import axios from 'axios'
 import { objectConvertToQuery } from '@/utils/index'
 /**
  * 用户中心订单
  * @param params {order_status}
  */
 export function ucenterOrder(params = {}) {
  let url = objectConvertToQuery(params)
   return request({
     url: PORT.order + url,
     method: 'get',
     data: params
   })
 }
 
 /**
  * 订单详情
  * @params {id}
  */
 export function ucenterOrderDetail(id){
   return request({
     url: PORT.order + '/'+id,
     method: 'get',
   })
 }
 /**
  * 订单选项
  */
 export function ucenterOrderOption(){
   return request({
     url: PORT.orderOption2,
     method: 'get',
   })
 }

 /**
  * 取消订单
  */
  export function ucenterOrderCancel(params,id){
    return request({
      url: PORT.order + '/' + id,
      method: 'put',
      data: qs.stringify(params)
    })
  }

 /**
  * 提交评价
  * @params {params}
  */
  export function ucenterOrderComment(params){
    return request({
      url: PORT.comment,
      method: 'post',
      data: qs.stringify(params)
    })
  }

 /**
  * 全部评价
  * @params {params}
  */
  export function ucenterPersonOrderComment(id){
    return request({
      url: PORT.comment + '?commentid=' + id,
      method: 'get',
    })
  }

  /**
   * 查看评价
   * @param {*} id 
   * @returns 
   */
  export function viewPersonOrderComment(id){
    return request({
      url: PORT.mycomment + '?order_id=' + id,
      method: 'get',
    })
  }

/**
  * 预约列表
  */
 export function ucenterCheckLogs(params){
  let url = objectConvertToQuery(params)
  return request({
    url: PORT.checkLogs + url,
    method: 'get',
  })
}
/**
  * 预约详情
  */
 export function ucenterCheckLogsInfo(id){
  return request({
    url: PORT.checkLogs + '/' + id,
    method: 'get',
  })
}
/**
  * 取消预约
  */
 export function ucenterCheckLogsPutInfo(params,id){
  return request({
    url: PORT.checkLogs + '/' + id,
    method: 'put',
    data: qs.stringify(params)
  })
}
/**
  * 预约选项
  */
 export function ucenterCheckLogsOption(){
  return request({
    url: PORT.checkLogs + '/select',
    method: 'get',
  })
}
/**
  * 预约服务时间
  */
 export function checkServiceTime(id){
  return request({
    url: PORT.serviceTime + '?check_id=' + id,
    method: 'get',
  })
}
/**
  * 护理预约时间
  */
 export function checkHuliServiceTime(id){
  return request({
    url: PORT.nurseDateOption + '?check_id=' + id,
    method: 'get',
  })
}
